package com.ad.pet.app.serach.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.models.remote.KeyWord;

import java.util.List;

/**
 * Created by SEELE on 2018/3/28.
 */

public class SerachKeyWordAdapter extends BaseQuickAdapter<KeyWord,BaseViewHolder> {
    public SerachKeyWordAdapter( @Nullable List<KeyWord> data) {
        super(R.layout.item_keyword, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, KeyWord item) {
        TextView tvKeyWord =  helper.getView(R.id.tv_keyword);


        if (!TextUtils.isEmpty(item.getName())){
            tvKeyWord.setText(item.getName());
            if (item.getIs_hot()==1){
                tvKeyWord.setTextColor(mContext.getResources().getColor(R.color.colorAccent));

            }
        }else {
            tvKeyWord.setText(item.getTitle());
        }
    }
}
